const errors = require('error');


/**
 * 登陆检测
 * @param {Function} next          [description]
 * @yield {[type]}   [description]
 */
function* validateLogon(next) {
	let session = yield this.getSession();
	if (!session || !session.id) errors.throwNeedSignIn();
	// 注入用户信息
	this.adminId = session.id;
	// console.log('-------------userId----------------', this.userId);
	return yield next;
}


module.exports = {
	validateLogon
}